package com.changgou.goods.controller;


import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.goods.service.SpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/spec")
public class SpecController {


    @Autowired
    private SpecService specService;

    /**
     * @param categoryName
     * @return com.changgou.entity.Result
     * @description: 根据商品分类名称查询规格列表
     * @author 大佬味的小男孩
     * @date 2020/07/17 17:10
     */
    @GetMapping("/category/{categoryName}")
    public Result findListByCategoryName(@PathVariable("categoryName") String categoryName) {
        List<Map> speclist = specService.findListByCategoryName(categoryName);
        return new Result(true, StatusCode.OK, "查询成功", speclist);
    }




}
